package test4;

import java.util.ArrayList;
import java.util.List;

public class Order {
    private String createDate;
    private String status;
    private List<OrderDetail> orderDetails;
    private Payment payment;

    public Order(String createDate, String status) {
        this.createDate = createDate;
        this.status = status;
        orderDetails = new ArrayList<>();
    }

    public void addOrderDetail(OrderDetail orderDetail) {
        orderDetails.add(orderDetail);
    }

    public void setPayment(Payment payment) {
        this.payment = payment;
    }

    public String getCreateDate() {
        return createDate;
    }

    public String getStatus() {
        return status;
    }

    public double calculateTotal() {
        double total = 0.0;
        for (OrderDetail detail : orderDetails) {
            total += detail.calculateSubTotal();
        }
        return total;
    }

    public List<OrderDetail> getOrderDetails() {
        return orderDetails;
    }

    public Payment getPayment() {
        return payment;
    }

}















